# ------------------------------------- #
# Replication code for:
#
# Pomeroy, Caleb "Hawks Become Us: The Sense of Power and Militant Foreign Policy Attitudes," Security Studies.
#
# This script estimates interactions between gender and the sense of power, raised during the SS exchange 
# with McDermott and Kupchan
# ------------------------------------- #

# --- set your working directory --- #
setwd("~/Downloads/hawks_replication/")

# --- libraries --- #
library(readr)
library(ggplot2)
library(texreg)
library(mediation)
library(plyr)
library(scales)
library(caret)
library(ggeffects)
library(ggh4x)


# --- import data --- #
# --- app data
app_survey <- read_csv("data/app_survey.csv")
app_survey$gender <- factor(app_survey$gender, levels = c("non_male", "male"))
# NB: to ease interpretation, sense of power (higher = greater feeling of power) and ideology (higher = more conservative) are scaled to mean 0 and SD 1; 
# MI is scaled to 0-1; age is retained on a numeric scale. 

# --- russia data
russia_survey <- read_csv("data/russia_survey.csv")
russia_survey$gender <- factor(russia_survey$gender, levels = c("female", "male"))
russia_survey$education <- factor(russia_survey$education, levels = c("bachelors", "less_bachelors"))
# NB: each of the following scaled to mean 0 and SD 1: sense of power (higher = greater feeling of power), national attachment, harm/care, fairness/reciprocity, ingroup/loyalty, authority/respect;
# MI is scaled to 0-1; age is retained on a numeric scale; the maritime security DV ("boat_threat") is retained on a Likert scale (higher = more unilaterally aggressive)

# --- qualtrics US data (survey #1, which included in-depth scenario)
qualtrics_survey_scenario <- read_csv("data/us_survey1.csv")
qualtrics_survey_scenario$gender <- factor(qualtrics_survey_scenario$gender, levels = c("non_male", "male"))
# NB: each of the following scaled to mean 0 and SD 1: sense of power (higher = greater feeling of power), national attachment, political ideology (higher = more conservative); for party ID ("pid"), "non_republican" captures moderates and democrats;
# MI, preventive strikes ("iran_strike"), and nuke support ("iran_nukes") are scaled to 0-1; age was collected and retained in bins (1 = 18-24, 2 = 25-34, 3 = 35-44, 4 = 45-54, 5 = 55-64, 6 = 65-74, 7 = 75-84, 8 = 85+)

# --- china data
china_survey <- read_csv("data/china_survey.csv")
china_survey$gender <- factor(china_survey$gender, levels = c("female", "male"))
# NB: each of the following scaled to mean 0 and SD 1: sense of power (higher = greater feeling of power), national attachment, harm/care, fairness/reciprocity, ingroup/loyalty, authority/respect;
# binding foundations is simply the sum of authority/respect and ingroup/loyalty scores
# MI, aggressive intentions ("aggressive_intentions"), and US threat perception ("us_threats") are scaled to 0-1; age was collected and retained in bins (1 = 18-24, 2 = 25-34, 3 = 35-44, 4 = 45-54, 5 = 55-64, 6 = 65-74, 7 = 75-84, 8 = 85+)

# --- qualtrics US data (survey #2, which included multiple measures of individual differences)
qualtrics_survey_inddiffs <- read_csv("data/us_survey2.csv")
qualtrics_survey_inddiffs$gender <- factor(qualtrics_survey_inddiffs$gender, c("non_male", "male"))
qualtrics_survey_inddiffs$education <- factor(qualtrics_survey_inddiffs$education, levels = c("bachelors", "less_bachelors"))
# NB: each of the following scaled to mean 0 and SD 1: sense of power (higher = greater feeling of power), national attachment, harm/care, fairness/reciprocity, ingroup/loyalty, authority/respect,
# extraversion, agreeableness, conscientiousness, neuroticism, openness, rwa, sdo;
# MI is scaled to 0-1; age was collected and retained in bins (1 = 18-24, 2 = 25-34, 3 = 35-44, 4 = 45-54, 5 = 55-64, 6 = 65-74, 7 = 75-84, 8 = 85+)
# the individual "sense_power_" and "mi_" items are retained on original Likert scales, as described in the paper

# --- prolific US data (survey experiment)
prolific_survey <- read_csv("data/prolific_survey.csv")
prolific_survey$gender <- factor(prolific_survey$gender, levels = c("non_male", "male"))
prolific_survey$education <- factor(prolific_survey$education, levels = c("less_bachelors", "bachelors"))
# NB: each of the following represented with unidimensional factor scores: MI ("mi_factor"), sense of power ("sense_power_factor")
# each of the following scaled to mean 0 and SD 1: ideology, pid, national attachment.
# age was collected and retained in bins (1 = 18-24, 2 = 25-34, 3 = 35-44, 4 = 45-54, 5 = 55-64, 6 = 65-74, 7 = 75-84)



# --- Sense of State Power Explains Militant Internationalism --- #
# These are the main correlational models from the paper, showing that the sense of power explains positive variance in MI.
# Here, I simply add an interaction between gender and the sense of power to assess whether males 
# disproportionately explain the link between power and hawkishness. This analysis is motivated by 
# a useful point raised by Rose McDermott during our SS exchange.

summary(mi_us <- lm(mil_int ~ sense_power*gender + nat_attach + education + gender + age + 
                      harm_care + fairness_recip + ingroup_loyalty + authority_respect +
                      extraversion + agreeableness + conscientiousness + neuroticism + openness +
                      rwa + sdo, data = qualtrics_survey_inddiffs))
# sense_power:gendermale coef = 0.0228724, p = 0.165174

summary(mi_china <- lm(mi_war ~ sense_power*gender + nat_attach +  education + gender + age +
                         harm_care + fairness_recip + ingroup_loyalty + authority_respect, data = china_survey))
# sense_power:gendermale coef = -0.0462286, p = 0.000598

summary(mi_russia <- lm(mil_int ~ sense_power*gender + nat_attach + education + gender + age +
                          harm_care + fairness_recip + ingroup_loyalty + authority_respect, data = russia_survey))
# sense_power:gendermale coef = 0.03819, p = 0.090553

# This table mimics Table A4 of the appendix, which presents the main three correlational model results from the paper
# The table's final row presents the interactions between power and gender.
screenreg(list(mi_us, mi_china, mi_russia))
# In short, although the US and Russia survey substantively point towards a larger male effect, the only
# interaction to reach the conventional alpha = .05 level of significance is in the China survey,
# and the negative sign indicates that, in fact, non-males show a slightly larger relationship
# between the sense of power and hawkishness. So, males do not appear to drive these results.

# --- Other correlational models
# In addition to the three primary models above, the paper's other correlational surveys allow for estimation 
# of the same gender x power moderation effect.

# app survey
summary(mi_app <- lm(mi_war ~ sense_power*gender + ideology + gender + age + urban_rural + education + white, data = app_survey))
# sense_power:gendermale coef = 0.034406, p = 0.025232

# the other qualtrics survey in the US, which contained the Iran scenario
summary(mi_us2 <- lm(mil_int ~ sense_power*gender + ideology + gender + age + white + pid + nat_attach, data = qualtrics_survey_scenario))
# sense_power:gendermale coef = 0.034656, p = 0.0085

# This table mimics Table A5 of the appendix, which presents further correlational evidence for the paper's argument
# The table's row for the "sense_power:gendermale" estimate presents the interactions between power and gender.
screenreg(list(mi_app, mi_us2))
# In short, the positive and significant coefficients suggest that males in these two samples are slightly 
# more likely to explain the relationship between the sense of power and hawkishness.


# --- Experimental Results: Sense of Power Activates Militant Internationalism --- #
# Finally, the survey experiment provides perhaps the cleanest test of McDermott's expectations about males
# driving the relationship between power and hawkishness.
# The experiment randomly varies relative state power (rise, decline, no power info), finding that rise activates hawkishness (MI)
# relative to decline; and, decline activates dovishness relative to the baseline, no power info condition.

# rise condition relative to decline condition
prolific_survey$power_trt <- factor(prolific_survey$power_trt, levels = c("low_power", "control", "high_power"))
summary(rise_vs_decline <- lm(mi_factor ~ power_trt*gender + age + ethnicity + education + ideology + pid + nat_attach, subset(prolific_survey, power_trt %in% c("high_power", "low_power"))))
# power_trthigh_power:gendermale coef = 0.152186, p = 0.12997

# decline condition relative to control condition 
prolific_survey$power_trt <- factor(prolific_survey$power_trt, levels = c("high_power", "control", "low_power"))
summary(decline_vs_baseline <- lm(mi_factor ~ power_trt*gender + age + gender + ethnicity + education + ideology + pid + nat_attach, subset(prolific_survey, power_trt %in% c("control", "low_power"))))
# power_trthigh_power:gendermale coef = -0.17001, p = 0.074906

# This table mimics Table A15 of the appendix, which presents the experimental results.
# The table's row for the "power_trthigh_power:gendermale" estimate presents the interaction between 
# the rise (vs decline) condition and gender. The row for the "power_trtlow_power:gendermale" estimate
# presents the interaction between the decline (vs control) condition and gender.
screenreg(list(rise_vs_decline, decline_vs_baseline))
# In short, neither coefficient reaches the conventional alpha = .05 level of significance. And, surprisingly,
# the effect that comes closest is the negative interaction between gender and decline, suggesting that men actually
# become slightly more dovish than women under conditions of decline. 

# Taken together, across all six surveys: interactions between gender and the sense of power are highly mixed.
# Sometimes males are more hawkish with power, sometimes non-males are more hawkish with power, and often times
# the interactions are simply null. These results suggest that men do not disproportionately drive the paper's
# results, a very useful question raised by McDermott. However, these results are highly consistent with 
# psychological work on power that shows that all humans are prone to power's effects. That being said,
# it could be the case that some of the surveys are underpowered to detect this interaction, so there is
# much interesting future work to be done on the relationship between power and gender.

